<!doctype html>
<html>

<head>
  <!-- css文件 -->
  {include file="public/title" /}
</head>
<body data-type="generalComponents">
  <!-- 头部 -->
  {include file="public/header" /}
  <div class="tpl-page-container tpl-page-header-fixed">
    <!-- 左侧导航 -->
    {include file="public/leftNav" /}
    <div class="tpl-content-wrapper">
      <ol class="am-breadcrumb">
        <li><a href="#" class="am-icon-home">首页</a></li>
        <li><a href="#">会员管理</a></li>
        <li class="am-active">会员列表</li>
      </ol>
      <div class="tpl-portlet-components">
        <div class="tpl-block">
          <div class="am-g">
            <div class="am-u-sm-12 am-u-md-6">
              <div class="am-btn-toolbar">
                <div class="am-btn-group am-btn-group-xs">
                  <button type="button" class="am-btn am-btn-default am-btn-success"><a href="javascript:void(orders());" style="color:#fff;">更新排序</a></button>
                </div>
              </div>
            </div>
            <div class="am-u-sm-12 am-u-md-3">
              <div class="am-form-group">
              </div>
            </div>
            <div class="am-u-sm-12 am-u-md-3">

              <form action="" method="GET">
                <div class="am-input-group am-input-group-sm">
                  <input type="text" name="get" class="am-form-field" placeholder="请输入编号、姓名或电话">
                  <span class="am-input-group-btn">
                    <button class="am-btn  am-btn-default am-btn-success tpl-am-btn-success am-icon-search" type="submit"></button>
                  </span>
                </div>
              </form>

            </div>
          </div>
          <div class="am-g">
            <div class="am-u-sm-12">
              <table class="am-table am-table-striped am-table-hover table-main">
                <thead>
                  <tr>
                    <th class="table-title" width="5%">排序</th>
                    <th class="table-title" width="5%">编号</th>
                    <th class="table-title" width="10%">姓名</th>
                    <th class="table-title" width="15%">电话</th>
                    <th class="table-title" width="10%">余额</th>
                    <th class="table-title" width="10%">积分</th>
                    <th class="table-title" width="15%">创建时间</th>
                    <th class="table-set" width="35%">操作</th>
                  </tr>
                </thead>
                <tbody>
                  <form id="sort" onsubmit="return false">
                  {volist name="user" id="value"}
                  <tr>
                    <td>
                      <input type="text" name="sort[]" value="{$value.sort}" style="width:35px;">
                      <input type="hidden" name="id[]" value="{$value.id}" >
                    </td>
                    <td>{$value.id}</td>
                    <td>{$value.name}</td>
                    <td>{$value.tel}</td>
                    <td>{$value.balance}</td>
                    <td>{$value.integral}</td>
                    <td>{$value.create_time|date="Y-m-d H:i:s",###}</td>
                    <td>
                      <div class="am-btn-toolbar">
                        <div class="am-btn-group am-btn-group-xs">
                            <a href="{:url('edit',['id'=>$value.id])}"><button class="am-btn am-btn-default am-btn-xs am-text-secondary" disabled style="opacity: 1;"><span class="am-icon-pencil-square-o"></span>
                            编辑</button></a>
                            <a href="{:url('spend',['id'=>$value.id])}"><button class="am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only" style="color:#000; opacity: 1;" disabled><span
                              class="am-icon-btc"></span>
                            消费</button></a>
                            <a href="{:url('recharge',['id'=>$value.id])}"><button class="am-btn am-btn-default am-btn-xs am-text-secondary" style="color:rgb(153, 10, 129); opacity: 1;" disabled><span class="am-icon-jpy"></span>
                            充值</button></a>
                            <a href="{:url('jfspend',['id'=>$value.id])}"><button class="am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only" style="color:#000; opacity: 1;" disabled><span
                              class="am-icon-btc"></span>
                            积分消费</button></a>
                            <a href="{:url('jfrecharge',['id'=>$value.id])}"><button class="am-btn am-btn-default am-btn-xs am-text-secondary" style="color:rgb(153, 10, 129); opacity: 1;" disabled><span class="am-icon-jpy"></span>
                            积分充值</button></a>
                        </div>
                      </div>
                    </td>
                  </tr>
                  {/volist}
                  </form>
                </tbody>
              </table>
              <div class="am-cf">
                <div class="am-fr">
                  <!-- 分页 -->
                  {$user->render()}
                </div>
              </div>
              <hr>
            </div>
          </div>
        </div>
        <div class="tpl-alert"></div>
      </div>
    </div>
  </div>
  <!-- js -->
  {include file="public/foot" /}
</body>
<script type="text/javascript">
  function orders()
  {
    var sort = $('#sort').serialize();
    $.ajax({
      url:"{:url('User/orders')}",
      data:sort,
      type:'post',
      async: false,
      success:function(res) {
        if(res.code == 1) {
          layer.alert(res.msg, function(index){
            location.href = res.url;
          })
        } else {
          layer.msg(res.msg);
        }
      }
    })
  }
</script>
</html>